package com.example.springbootbookv2.repository;

import com.example.springbootbookv2.model.User;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Collection;
import java.util.List;

/**
 * 用户Repository
 * @author waqwb
 */
public interface UserRepository extends JpaRepository<User,String> {
    /**
     * 通过名字相等查询
     * select u from user u where u.name = ?
     * @param name
     * @return
     */
    List<User> findByName(String name);

    /**
     * 通过名字like查询
     * select u from user u where u.name like ?
     * @param name
     * @return
     */
    List<User> findByNameLike(String name);

    /**
     * 通过主键id集合查询
     * select u from user u where id in (?,?,?)
     * @param ids
     * @return
     */
    List<User> findByIdIn(Collection<String> ids);


}
